﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Sicurezza.CA.Manager;
using System.Text;

namespace Sicurezza.CA.Server.Controlli
{
    public partial class CertificateControl : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
        {
            // Visualizza Certificato
            e.Cancel = true;
            string Id = GridView1.Rows[e.NewEditIndex].Cells[0].Text;
            TextBox1.Text = X509Manager.GetView(Id);
            MultiView1.ActiveViewIndex = 1;
        }

        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            // Download Certificato
            e.Cancel = true;
            string Id = GridView1.Rows[e.RowIndex].Cells[0].Text;
            Response.Redirect("~/DownloadHandler.ashx?id=" + Id, true);
           
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            MultiView1.ActiveViewIndex = 0;
        }


    }
}